#ifndef EQUALIZER_H
#define EQUALIZER_H

#include "effects.h"

/*==============================================================================
			Derived effect class. It shows equalizer with history.
==============================================================================*/

class Equalizer : public Effect
{
public:
	Equalizer(Video* video, Sound* sound);
	~Equalizer();

	virtual void Render();

private:
	// Structure data for one line, which represents one member in spectrum array
	struct Bar
	{
		int id;
		float length;
		Color color;
		Bar* next;
	};	

	// Structure for dynamic list of lists of bars
	struct History
	{
		int id;
		Bar* bars;
		History* next;
	};

	// Sound spectrum array
	float* spectrum;
	// Sound spectrum values
	int spectrum_values;

	// Points to equalizer data list
	History* history;
	// Shows which history element is shown
	History* this_hist;
	// Tells if program have filled all history list
	bool hist_full;

	// Adds and fills a bar in current "hist" element
	void AddBar(History* hist);
	// Adds empty history member to an end of the list
	void AddHistory();
	// Changes existing bar
	void ChangeBar(History* hist);
	// Creates first member on the history list
	void CreateHistory();

	// Draw given bar or history
	void DrawBar(Bar* bar);
	void DrawHistory(History* hist);

	

};

#endif // EQUALIZER_H